"""
count = 0
for i in range (1,5):
    for j in range(1, 5):
        for k in range(1, 5):
            if i != j  != k:
                count += 1
                print("%d%d%d" %(i,j ,k),end = ' ')
print()
print("1-4的组合所输入的总和三位数:>" + str(count))
"""


"""
num = int(input("请输入年月日:>"))

arr1 = (0,31,29,31,30,31,30,31,31,30,31,30,31)
arr2 = (0,31,28,31,30,31,30,31,31,30,31,30,31)

my_tuple1 = tuple(arr1)
my_tuple2 = tuple(arr2)

day = num % 100
num //= 100
month = num % 100
num //= 100
year = num

sum = 0
if ((year % 4 == 0) and (year % 100 != 0)) or (year % 400 == 0):
    for i in range(1 , month):
       sum += arr1[i]
else:
    for i in range(1 , month):
       sum += arr2[i]

sum += day
print("一共有：%d 天"%(sum))
"""

"""
n = int(input("请输入项数：>"))
f1 = 1
f2 = 1
i = 3
sum = 0
if n > 2 :
    while i <= n :
       sum = f1 + f2
       f1 = f2
       f2 = sum
       i += 1
else:
    sum = 1
print("第 %d 项的数字是 %d "%(n,sum))
"""


"""
num = int(input("请输入一个数:>"))
sum1 = 0
sum2 = 0
for i in range(1,num + 1):
    if i % 2 == 1:
        sum1 += 1
    else:
        sum2 += 1
print("%d %d"%(sum1,sum2))

"""


num = 0
for i in range(1 , 2020):
    if (i / 100) % 10 == 9 and (i / 10) % 10 == 9 or i % 10 == 9 :
        num += 1
print(num)